import tool from '@/utils/tool'
import { Modal, notification } from 'ant-design-vue'
import { MessageOutlined } from '@ant-design/icons-vue'
import sysConfig from '@/config/index'
import { userCenterStore } from '@/store'

// 用户登出
export const loginOut = (message) => {
	//弹出对话框
	Modal.error({
		title: '提示：',
		okText: '知道了',
		content: message,
		onOk: () => {
			tool.data.remove(sysConfig.ACCESS_TOEKN_KEY)
			tool.data.remove(sysConfig.REFRESH_TOEKN_KEY)
			tool.data.remove('USER_INFO')
			tool.data.remove('MENU')
			tool.data.remove('PERMISSIONS')
			window.location.reload()
		}
	})
}

// 新消息
export const NewMessage = (message) => {
	userCenterStore().increment() //未读加1
	//弹出消息
	notification.open({
		message: '收到一条新的消息!',
		description: message,
		type: 'info',
		duration: 2,
		top: '80px'
	})
}

// 新消息
export const SystemNotice = (message) => {
	//弹出消息
	notification.warning({
		message: '系统提示!',
		description: message,
		duration: 2,
		top: '80px'
	})
}
